package com.newland.zxy.service;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @author : zhangxuyuan
 * @Project: springsecurity
 * @Package com.newland.zxy.service
 * @date Date : 2021年02月23日 8:54
 */
//@Service
public class MyUserDetailsService implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        //从dao层查出用户
//        MyUser myUser=userDao.selectUserById(s);
        UserDetails details = User
                .withUsername(s)
                .password("密码")
                .authorities("权限一", "权限二").build();
        return details;
    }
}
